<template>
  <el-form-item :class="getClz()" :label="opt.text" :prop="opt.name" v-if="!opt.hide" >
    <ComNumber
      :row="data"
      :name="opt.name"
      :max="opt.max"
      :min="opt.min"
      :maxin="opt.maxin"
      :minin="opt.minin"
      :fixed="opt.fixed"
      :placeholder="opt.placeholder"
      :disabled="opt.props.disabled"
      @change="onChange(data,column)"
      @keyup="onKeyup(data,column)"></ComNumber>
  </el-form-item>
</template>

<script>
    import extend from '../extend';
    import ComNumber from "../com/number";

    export default {
      name: "FormNumber",
      mixins:[extend],
      components:{ ComNumber },
      data(){
        return {
          opt:{
            name:'',
            text:'',
            prop:'',
            props:{
                type:'text',
                disabled:false
            },
            hide:false,
            fixed:{
              type:[Number,String],
              default:"2"
            },
            formatter:(v)=>{return v}
          }
        }
      },
      created(){
        this.initOptions();
        this.onChange = this.column.onChange||LOG;
        this.onKeyup = this.column.onKeyup||LOG;
      },
      methods:{
        setValue(val){
          this.data[this.opt.name] = this.opt.formatter(val);
        }
      }
    }
</script>
